import Vue from 'vue'
import VueRouter from 'vue-router'
// import HomeView from '../views/HomeView.vue'
// const HomeView = () => import('./views/HomeView.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login',
    hidden: true,
    component: () => import('@/views/LoginView')
  },
  {
    path: '/login',
    name: 'login',
    hidden: true,
    component: () => import('@/views/LoginView')
  },
  {
    path: '/enroll',
    name: 'enroll',
    hidden: true,
    component: () => import('@/views/EnrollView')
  },

  {
    path: '/home',
    name: '商品管理',
    redirect: '/home/dataBrowse',
    iconClass: 'el-icon-goods',
    component: () => import('@/views/HomeView'),
    children: [
      {
        path: '/home/dataBrowse',
        name: '数据概览',
        component: () => import('@/components/commodity/dataBrowse'),
      },
      {
        path: '/home/commodityList',
        name: '商品列表',
        component: () => import('@/components/commodity/commodityList'),
      },
      {
        path: '/home/addCommodity',
        name: '添加商品',
        component: () => import('@/components/commodity/addCommodity'),
      },

    ]

  },
  {
    path: '/home',
    name: '用户管理',
    iconClass: 'el-icon-user',
    component: () => import('@/views/HomeView'),
    children: [
      {
        path: '/home/userList',
        name: '用户列表',
        component: () => import('@/components/user/userList'),
      },
      {
        path: '/home/userSet',
        name: '用户设置',
        component: () => import('@/components/user/userSet'),
      },
    ]

  },
]

const router = new VueRouter({
  routes
})

export default router
